logo

This script runs prequisite data importing/cleaning scripts necessary for almost all other analyses.

Load data

Three Rivers databases and files are ingested with two scripts:

  • Scripts/1_Data_Import.R: imports the bird and vegetation survey databases maintained by Three Rivers (.accdb format) into R. Each table in the databases is imported as its own data frame object.

  • Scripts/2_Spatial_Data_Import.R: imports Three Rivers spatial data maintained in Three Rivers geodatabases into R. Each feature class becomes an sf data frame object.

library(here)
source(here("Scripts", "1_Data_Import.R"))
source(here("Scripts", "2_Spatial_Data_Import.R"))

Note: to update the files/databases used in these analyses update the file paths in the data import scripts.

The data imported by 1_Data_Import.R include the following files:

The data imported by 2_Spatial_Data_Import.R include the following files:

Clean data

Data are further processed with a data cleaning script (Scripts/3_Data_Cleaning.R) before being fed into subsequent analyses. Cleaning steps include:

  • Spatial burn management unit data: tidy park names; add missing year planted dates

  • Spatial bird survey transects: tidy park names; create spatial transects for surveys that do not have spatial data

  • MLCCS habitat types: align spelling/styling of categories across current and future layers

source(here("Scripts", "3_Data_Cleaning.R"))

Note: many of the fixes made by cleaning script should eventually be applied to the original data files, but for now are done programatically for

Prepare covariate data

Scripts/4_Covariate_Data_Prep.R is run to prepare assorted environmental data for use in other analyses. Specifically, the script prepares the following objects:

  • area_by_year: cumulative total area of restored grasslands at Crow-Hassan by year

  • spring_precip: spring precipitation at Crow-Hassan by year from PRISM data

  • burns: a tidied and “long” version of the master burn spreadsheet indicating which units were burned in which years.

source(here("Scripts", "4_Covariate_Data_Prep.R"))

Align bird taxonomy

Scripts/5_Prep_Species.R aligns the TRPD bird species table with the eBird taxonomy, which facilitates combination/comparison with other datasets. The script also importa the Avian Conservation Assessment Database and MN BBA species lists (with habitat associations), which are used to generate a list of grassland species.

source(here("Scripts", "5_Prep_Species.R"))
 




By Sam Safran